package Server.Sessions;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class ActiveSessions {
	private Collection<ClientSession> sessionList = new ArrayList<ClientSession>(); 

	public synchronized void addSession(ClientSession s) { // this lukku!
		getSessionList().add(s);
		System.out.println("Saabus uus klient: " + s);
	}

	public synchronized Iterator<ClientSession> iterator() {
		return getSessionList().iterator();
	}

	public int sessionListSize() {
		return getSessionList().size();
	}

	/**
	 * @param sessionList the sessionList to set
	 */
	public void setSessionList(Collection<ClientSession> sessionList) {
		this.sessionList = sessionList;
	}

	/**
	 * @return the sessionList
	 */
	public Collection<ClientSession> getSessionList() {
		return sessionList;
	}
}